Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Nanosoldier to Julia 0.6 and JSON benchmarks #38

Merged
merged 2 commits into from
Nov 1, 2017
Merged

Conversation

ararslan
Copy link
Member

In order to use the fancy new BenchmarkTools JSON-based serialization, we also need to update the Nanosoldier to use Julia 0.6.

I'm not intimately familiar with this code but the fact that benchmarks are loaded from JLD files as a Dict seems to be a pretty deep-seated assumption, so that will be a challenge to unravel completely.

@ararslan ararslan requested a review from jrevels October 25, 2017 03:46
REQUIRE Outdated
@@ -1,7 +1,6 @@
julia 0.4
julia 0.6
BenchmarkTools 0.0.7
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't BenchmarkTools be also updated with the new minimum after it's tagged of course

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It isn't tagged yet.

@jrevels
Copy link
Member

jrevels commented Oct 26, 2017

benchmarks are loaded from JLD files as a Dict seems to be a pretty deep-seated assumption, so that will be a challenge to unravel completely.

Is this the case? I think what was being saved/loaded from the JLD file is a BenchmarkGroup, i.e. the type of results here is BenchmarkGroup. That function's caller stores/passes around this BenchmarkGroup in a Dict (confusingly also named results), but that shouldn't be a problem wrt (de)serialization.

It's been a while, though...I could be misremembering 😛

@ararslan ararslan force-pushed the aa/the-future branch 2 times, most recently from 3ac1e2b to 27c41b5 Compare October 28, 2017 01:21
@ararslan
Copy link
Member Author

I added a commit that turns on precompilation but had to revert it because apparently GitHub.jl doesn't support it. I can try again (perhaps in a separate PR, depending on how long this is open) after JuliaWeb/GitHub.jl#93 is merged and tagged.

loaded = BenchmarkTools.load(benchresults)[2]
ind = findfirst(x->isa(x, BenchmarkTools.BenchmarkGroup), loaded)
@assert ind > 0
results = loaded[ind]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you walk me through this? I had thought that BenchmarkTools.load(benchresults) would return results::BenchmarkGroup directly, since that what was saved via BenchmarkTools.save earlier. I'm probably misremembering something...

Copy link
Member Author

@ararslan ararslan Oct 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the JSON format, save writes

[{"Julia":"x.y.z","BenchmarkTools":"0.2.0"},[["BenchmarkTools.BenchmarkGroup",{"tags":[...],"data":{...}}]]]

Then load makes this

[Dict("Julia"=>"x.y.z", "BenchmarkTools"=>"0.2.0"), [BenchmarkGroup(...)]]

That is, the result is a two-element array where the first is the version information and the second is an array of the deserialized values.

loaded = BenchmarkTools.load(benchresults)[2] # gets the vector of values
ind = findfirst(x->isa(x, BenchmarkGroup), loaded) # figure out which of the elements is a BenchmarkGroup
@assert ind > 0 # make sure one of them is
results = loaded[ind] # retrieve the BenchmarkGroup

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. At some point in the future, we should change load to just return the second element, without the version info Dict. AFAICT there's no reason for load to expose version info to the caller. My bad, I should've caught this when reviewing JuliaCI/BenchmarkTools.jl#79. Let's ignore it for now, though, for poor Nanosoldier's sake.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd might as well make that change now before too many packages start depending on the current behavior.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah I'm just an idiot, this is already how it works.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...well that was the easiest API patch ever 😛

@@ -336,7 +336,7 @@ function execute_benchmarks!(job::BenchmarkJob, whichbuild::Symbol)
results = run(benchmarks; verbose = true)

println("SAVING RESULT...")
BenchmarkTools.save(\"$(benchresults)\", "results", results)
BenchmarkTools.save(\"$(benchresults)\", results)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The benchresults filename extension needs to be changed from .jld to .json here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱

@jrevels
Copy link
Member

jrevels commented Oct 28, 2017

I added a commit that turns on precompilation

No reason not to enable precompilation here, but it wouldn't actually matter, right? IIRC the server should only ever be launched with --precompile=no --compilecache=no because we're not running on a networked filesystem, so the precompile state UUID doesn't match up correctly with the UUIDs of the Julia binaries built for each node. Maybe that's been fixed by now, though?

@ararslan
Copy link
Member Author

Maybe that's been fixed by now, though?

I believe so, which is why I wanted to experiment with precompilation.

@JeffBezanson
Copy link

Bump. How are we doing here?

@ararslan
Copy link
Member Author

So far so good. BaseBenchmarks needs to be updated, and I'm working on that, then I'll need to do some testing on Nanosoldier. This is at the top of my priority list.

@@ -3,7 +3,7 @@ language: julia
os:
- linux
julia:
- release
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- 0.6 should be added here in place of release, yeah?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably

@ararslan ararslan changed the title WIP: Update Nanosoldier to Julia 0.6 and JSON benchmarks Update Nanosoldier to Julia 0.6 and JSON benchmarks Nov 1, 2017
@jrevels jrevels merged commit 29f098c into master Nov 1, 2017
@ararslan ararslan deleted the aa/the-future branch November 1, 2017 17:54
ararslan added a commit that referenced this pull request Nov 2, 2017
In #38, `NanosoldierError` was mistakenly changed from being declared as
`type` to `struct`. The object is constructed piecemeal in the benchmark
job code, so the type needs to be mutable.
@ararslan ararslan mentioned this pull request Nov 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants